<?php
/**
 * Created by PhpStorm.
 * User: zc
 * Date: 2019/8/20
 * Time: 18:50
 */
namespace app\common\logic;

use think\Db;
use think\Exception;

class SuggestLogic
{
    private $content = '';
    private $user_id = 0;
    private $org_cate_id = 0;

    public function saveSuggest()
    {
        try{
            Db::startTrans();
            $data['user_id'] = $this->user_id;
            $data['content'] = $this->content;
            $data['org_cate_id'] = $this->org_cate_id;
            $data['createtime'] = time();
            Db::name('user_suggesions')->insert($data);
            Db::commit();
            return true;
        }catch (Exception $e){
            Db::rollback();
            return false;
        }

    }

    /**
     * @param $user_id
     * @return $this
     */
    public function setUserId($user_id)
    {
        $this->user_id = $user_id;
        return $this;
    }
    /**
     * @param $org_cate_id
     * @return $this
     */
    public function setOrgCateId($org_cate_id)
    {
        $this->org_cate_id = $org_cate_id;
        return $this;
    }
    /**
     * @return int
     */
    public function getUserId(){
        return $this->user_id;
    }
    /**
     * @param $content
     * @return $this
     */
    public function setContent($content)
    {
        $this->content = $content;
        return $this;
    }

    /**
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }


}